package com.geor.gcv.core.process;

import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.imgproc.Imgproc;

/**
 * 缩放图片
 * 
 * @author geor.lusongnan
 *
 */
public class ResizeProcess extends Process {
	private Process chain;
	private double times;

	public ResizeProcess(Process chain, double times) {
		this.chain = chain;
		setTimes(times);
	}

	@Override
	public String getProcessName() {
		return chain.getProcessName() + "-->缩放图片";
	}

	@Override
	public Mat process() {
		Mat mat = chain.process();
		if (times == 1)
			return mat;
		Mat resize = new Mat();
		Imgproc.resize(mat, resize, new Size(mat.size().width * times, mat.size().height * times));
		return resize;
	}

	public double getTimes() {
		return times;
	}

	public void setTimes(double times) {
		this.times = times;
	}
}
